/*
 * @Autor: liszt
 * @Date: 2021-06-15 09:40:45
 * @LastEditors: dingxiaolin
 * @LastEditTime: 2021-06-30 15:48:35
 */
import http from '@/utils/http/axios'
import qs from 'qs'
import { Base64 } from 'js-base64'
import { type } from './interface'
import setting from '@/config/defaultSettings'
const { clientId, clientSecret } = setting

/**
 * @description: 分页查询系统字典类型
 */
export function sysDictTypePage(params) {
    return http.request<type.dictTypePage>({
        url: `/app-admin/dict/page`,
        method: 'GET',
        params
    })
}

/**
 * @description: 添加系统字典类型
 */
export function sysDictTypeAdd(params) {
    return http.request<type.dictTypeAdd>({
        url: `/app-admin/dict/add`,
        method: 'POST',
        params
    })
}

/**
 * @description: 编辑系统字典类型
 */
export function sysDictTypeEdit(params) {
    return http.request<type.dictTypeEdit>({
        url: `/app-admin/dict/edit`,
        method: 'POST',
        params
    })
}

/**
 * @description: 删除系统字典类型
 */
export function sysDictTypeDelete(params) {
    return http.request<type.dictTypeDelete>({
        url: `/app-admin/dict/delete`,
        method: 'POST',
        params
    })
}

/**
 * @description: 获取字典类型下所有字典，举例，返回格式为：[{code:"M",value:"男"},{code:"F",value:"女"}]
 */
export function sysDictTypeDropDown(params) {
    return http.request<any>({
        url: `/app-admin/dict/dropDown`,
        method: 'GET',
        params
    })
}

/**
 * @description: 获取所有字典，启动时加入缓存使用
 */
export function sysDictTypeTree(params) {
    return http.request<any>({
        url: `/app-admin/dict/tree`,
        method: 'GET',
        params
    })
}

/**
 * @description: 获取字典列表
 */
export function sysDictDataPage(params) {
    return http.request<any>({
        url: `/app-admin/dict/data/page`,
        method: 'GET',
        params
    })
}

/**
 * @description: 新增字典
 */
export function sysDictDataAdd(params) {
    return http.request<type.dictDataAdd>({
        url: `/app-admin/dict/data/add`,
        method: 'post',
        params
    })
}

/**
 * @description: 编辑字典
 */
export function sysDictDataEdit(params) {
    return http.request<type.dictDataEdit>({
        url: `/app-admin/dict/data/edit`,
        method: 'post',
        params
    })
}

/**
 * @description: 删除字典
 */
export function sysDictDataDelete(params) {
    return http.request<type.dictDataDelete>({
        url: `/app-admin/dict/data/delete`,
        method: 'post',
        params
    })
}
